ErrorDocument 404 /404error.php
# BEGIN Define Mime Types (in case /etc/mime.types is poorly configured or incorrect)
<IfModule mod_mime.c>
AddType application/x-javascript		.js
AddType application/x-shockwave-flash	.swf
AddType image/bmp						.bmp
AddType image/gif						.gif
AddType image/jpeg						.jpeg
AddType image/jpg						.jpg
AddType image/png						.png
AddType image/svg+xml					.svg
AddType image/tif						.tif
AddType image/tiff						.tiff
AddType image/x-icon					.ico
AddType text/css						.css
AddType text/htm						.htm
AddType text/html						.html
AddType text/plain						.txt
AddType text/xml						.xml
AddType text/xsd						.xsd
AddType text/xsl						.xsl
</IfModule>
# END Define Mime Types

# BEGIN Headers: Ensure browser caching of objects for 3 days
# Set Expires header
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/x-javascript		A259200
ExpiresByType application/x-shockwave-flash	A259200
ExpiresByType application/wlwmanifest+xml	A259200
ExpiresByType image/bmp						A259200
ExpiresByType image/gif						A259200
ExpiresByType image/jpeg					A259200
ExpiresByType image/jpg						A259200
ExpiresByType image/png						A259200
ExpiresByType image/svg+xml					A259200
ExpiresByType image/tif						A259200
ExpiresByType image/tiff					A259200
ExpiresByType image/x-icon					A259200
ExpiresByType text/css						A259200
ExpiresByType text/htm						A259200
ExpiresByType text/html						A259200
ExpiresByType text/plain					A259200
ExpiresByType text/xml						A259200
ExpiresByType text/xsd						A259200
ExpiresByType text/xsl						A259200
</IfModule>

<FilesMatch "\.(bmp|css|ico|html?|js|tiff?|gif|jpe?g|png|svgz?|swf|txt|xsd|xsl|xml)$">
<IfModule mod_headers.c>
# Set Pragma header
Header set Pragma "public"
# Set Cache-Control header
Header append Cache-Control "public, must-revalidate, proxy-revalidate"
</IfModule>

# Set Entity Tag header
FileETag MTime Size
</FilesMatch>
# END Headers: Ensure client-side caching of objects

#php_value zlib.output_compression On
<ifModule mod_gzip.so>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

DirectoryIndex index.php

<Files ~ "^\.ht">
order allow,deny
satisfy all
</Files>
# Deny most common except .php (Also protects your .tpl template files)
<FilesMatch "\.(db|inc|tpl|tmpl|h|ihtml|sql|ini|class|bin|spd|theme|module|cfg|cpl|tmp|log|err)$">
order allow,deny
satisfy all
</FilesMatch>

RewriteEngine On

RewriteRule ^mp3/([0-9]+)/([^/]*)/([^/]*)(/?)+$ ?do=song&source=$1&title=$2&id=$3 [L]
RewriteRule ^video/([^/]*)/([^/]*)(/?)+$ ?do=video&id=$2&title=$1 [L]
RewriteRule ^search.html(/?)+$ ?do=search&%{QUERY_STRING} [L]
RewriteRule ^embed/([0-9]+)/([^/]*)/([^/]*)(/?)+$ embed.php?source=$1&title=$2&id=$3&%{QUERY_STRING} [L]
RewriteRule ^logout(/?)+$ ?do=logout [L]
RewriteRule ^settings(/?)+$ ?do=user [L]
RewriteRule ^settings(/?)+$ ?do=user [L]
RewriteRule ^playlist/edit/([0-9]+)(/?)+$ ?do=edit_playlist&id=$1 [L]
RewriteRule ^playlist/([0-9]+)(/?)+$ ?do=playlist&id=$1 [L]
RewriteRule ^playlists(/?)+$ ?do=playlists [L]
RewriteRule ^playlists/([0-9]+)(/?)+$ ?do=playlists&p=$1 [L]

RewriteRule ^([a-zA-Z0-9_-]+)(/?)$ ?do=profile&username=$1 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/favorites(/?)$ ?do=profile&username=$1&action=favorites [L]
RewriteRule ^([a-zA-Z0-9_-]+)/playlists(/?)$ ?do=profile&username=$1&action=playlists [L]

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none